package fr.labri.macchiato.client.cart;

import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.layout.HLayout;

/**
 * A progress label with an animated GIF
 * 
 * @author Matthieu FOUCAULT
 */
public class ProgressLabel extends HLayout {

	private static final int IMAGE_SIZE = 30;
	private static final int MEMBERS_MARGIN = 15;
	private static final String LOADING_GIF = "/icons/loading.gif";
	private Label label;
	private Img progressImage;

	/**
	 * Create a new progress label
	 * 
	 * @param contents Text to be displayed within the label
	 */
	public ProgressLabel(String contents) {
		super(MEMBERS_MARGIN);
		setWidth100();
		progressImage = new Img(LOADING_GIF, IMAGE_SIZE, IMAGE_SIZE);
		addMember(progressImage);
		label = new Label(contents);
		label.setWidth100();
		label.setValign(VerticalAlignment.TOP);
		addMember(label);
	}

}
